package storetesting;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import uk.ac.glasgow.electionsystem.impl.election.ElectionImpl;
import uk.ac.glasgow.electionsystem.impl.election.ElectionStoreImpl;

public class ElectionStoreImplTest {
	ElectionStoreImpl myStore;
	ElectionImpl election1;
	@Before
	public void setUp() throws Exception {
		myStore = new ElectionStoreImpl("elections.dt");
//		myStore.deleteFile();
		election1 = new ElectionImpl("name1", "type1");
		election1.setElectionID("id1");
//		myStore.addElectionImpl(election1);
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void test() {
		//myStore.deleteFile();
		assertTrue(myStore.containsEID("id1"));
		assertTrue("type1".equals(myStore.getElectionImpl("id1").getElectionType()));
//		myStore.removeElection("id1");
//		assertFalse(myStore.containsEID("id1"));
//		myStore.cleanElectionStoreAndCreateNewFile();
//		assertFalse(myStore.containsEID("id1"));
//		System.out.println(myStore.getTheElections().size());
//		assertTrue(myStore.getTheElections().size() == 1);
		assertTrue(null==myStore.getElectionImpl("sfe"));
	}

}
